<template>
      <div class="contentList">
            <ul>
                <li v-for="(item, index) in gameData" :key="index">
                    <div class="gameTitle">
                        <img :src="item.thumbnail" alt="">
                        <div class="gameName">
                            <div>
                                {{ item.title }}
                            </div>
                            <span class="strategy">
                                {{ item.strategy }}
                            </span>
                        </div>
                    </div>
                    <div class="playNow" @click="toDetail(item.id)">
                        Play Now
                    </div>
                </li>
            </ul>
        </div>
  </template>
  
  <script setup lang="ts">
  import { ref } from 'vue'
  import { useRouter } from 'vue-router'

const router = useRouter()

  const props = defineProps({
    gameData:{
        type:Array,
        required:true,
        default:[]
    }
  })

  const toDetail = (id:number) =>{
    router.push(`detail/${id}`)
}
  </script>
  
  <style lang="scss">
    .contentList {
        background-color: $bg-color3;
        padding: 2vh;
        min-height: calc(100vh - 94px);
        ul {
            li {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 16px;
                background-color: #004d8a;
                margin-bottom: 5px;
                border-radius: 6px;
                color: #fff;
                font-weight: 600;
                font-size: 14px;

                .gameTitle {
                    display: flex;
                    cursor: pointer;
                    img {
                        width: 64px;
                        height: 64px;
                        border-radius: 6px;
                    }

                    .gameName {
                        padding: 6px 0;
                        margin-left: 24px;
                        .strategy {
                            display: inline-block;
                            min-width: 60px;
                            margin-top: 10px;
                            border-radius: 6px;
                            padding: 6px 10px;
                            background: #ffc46e;
                            color: #3f3e3c;
                        }
                    }
                }

                .playNow {
                    background: linear-gradient(106deg, #ffb200, #ff7e00);
                    border: 0;
                    border-radius: 4px;
                    color: #fff;
                    height: 60%;
                    opacity: 1;
                    overflow: hidden;
                    padding: 8px 2%;
                    text-align: center;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    width: 28%;
                    cursor: pointer;
                }
            }
        }
    }
  </style>
  